PHP_REQUIRE_CXX()
CXXFLAGS="$CXXFLAGS -Wall -std=c++11 -Wunused-variable"

PHP_ARG_ENABLE(pushgateway, whether to enable pushgateway support,
[  --enable-pushgateway          Enable pushgateway support], no)

dnl AC_LANG_PUSH(C++)
dnl AX_CHECK_COMPILE_FLAG([-std=c++0x], , [AC_MSG_ERROR([compiler not accept c++11])])
dnl AC_LANG_POP()

if test "$PHP_PUSHGATEWAY" != "no"; then
  AC_DEFINE(HAVE_PUSHGATEWAY, 1, [ Have pushgateway support ])

  PHP_SUBST(PUSHGATEWAY_SHARED_LIBADD)
  PHP_ADD_LIBRARY(stdc++, 1, PUSHGATEWAY_SHARED_LIBADD)

  PHP_ADD_INCLUDE(src)

  PHP_ADD_EXTENSION_DEP(pushgateway, spl)
  PHP_ADD_EXTENSION_DEP(pushgateway, mysqlnd)
  PHP_ADD_EXTENSION_DEP(pushgateway, mysqli)
  PHP_ADD_EXTENSION_DEP(pushgateway, pdo)
  PHP_ADD_EXTENSION_DEP(pushgateway, curl)

  PHP_NEW_EXTENSION(pushgateway, pushgateway.cc src/helper.cc src/scaler.cc src/client.cc src/push_execute.cc src/push_init.cc src/push_curl.cc src/push_pdo.cc src/push_mysqli.cc src/push_predis.cc src/push_phpredis.cc, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
fi
